package com.jzmy.employment.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.plugins.Page;
import com.jzmy.employment.dao.RecruitmentNewsDao;
import com.jzmy.employment.entity.RecruitmentNews;
import com.jzmy.employment.entity.vo.RecruitmentNewsVo;
import com.jzmy.employment.service.RecruitmentNewsService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author mengzhichao
 * @create 2022-08-26-11:04
 */
@Service
public class RecruitmentNewsServiceImpl extends ServiceImpl<RecruitmentNewsDao, RecruitmentNews> implements RecruitmentNewsService {
    @Override
    public Page<RecruitmentNewsVo> selectListPage(int current, int number, Map map, String type) {
        // 新建分页
        Page<RecruitmentNewsVo> page = new Page<RecruitmentNewsVo>(current, number);
        if(type.equals("1")){//最新
            return page.setRecords(this.baseMapper.dyGetNewList(page,map));
        }else{//热门
            return page.setRecords(this.baseMapper.dyGetHotList(page,map));
        }
    }

    @Override
    public RecruitmentNews selJobDetails(Long id) {
        return this.baseMapper.selJobDetails(id);
    }

    @Override
    public List<String> selectRegion(String name) {
        return baseMapper.selectRegion(name);
    }

    public List<String> selectCity(String name) {
        return baseMapper.selectCity(name);
    }
}
